Skip to content

fix(virtualized-lists): invalidate content length on orientation change - #57871

Closed
fallintoplace wants to merge 1 commit into
react:mainfrom
fallintoplace:fix/virtualized-lists-content-length-orientation
Closed

fix(virtualized-lists): invalidate content length on orientation change#57871
fallintoplace wants to merge 1 commit into
react:mainfrom
fallintoplace:fix/virtualized-lists-content-length-orientation

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

When a list changes between vertical and horizontal layouts, ListMetricsAggregator resets its cell measurements but keeps _contentLength. That value belongs to the old scrolling axis. In horizontal RTL mode, it can then be used to calculate a cell offset before the new content layout is observed.

This clears _contentLength during horizontal orientation changes so RTL calculations wait for the new content length. The reset was present in the original orientation invalidation logic and was removed when bottom-up layout support was removed.

Changelog:

[GENERAL] [FIXED] - Invalidate list content length when orientation changes.

Test Plan:

  • Added regression coverage for vertical to horizontal content length invalidation.
  • Verified horizontal RTL metrics throw until new content layout is observed.
  • Ran yarn jest packages/virtualized-lists/Lists/__tests__/ListMetricsAggregator-test.js --runInBand.
  • Ran Prettier and targeted ESLint checks.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 9, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 9, 2026
@meta-codesync

meta-codesync Bot commented Aug 11, 2026

Copy link
Copy Markdown

@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D115586644.

@meta-codesync meta-codesync Bot closed this in e59a1d2 Aug 12, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Aug 12, 2026
@meta-codesync

meta-codesync Bot commented Aug 12, 2026

Copy link
Copy Markdown

@fabriziocucci merged this pull request in e59a1d2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant